$(function(a) {
	a("input[type='submit']").click(function() {
		var b = a("form").valid();
		if (b == true) {
			a(this).val("提交中，请稍候");
			var c = a(this);
			setInterval(function() {
				loading(c)
			},
			300);
			a(this).attr("disabled", "disabled");
			a(this).parents("form").submit()
		}
	});
	a("a").focus(function() {
		a(this).blur()
	});
	a(".b-icon").on("mouseover",
	function() {
		a(this).parent().find("div[class='popover fade top in']").remove();
		var b;
		if (a(this).attr("to") == "tosina") {
			b = {
				selector: true,
				html: true,
				content: "点击关注微美贷微博<br/><a href=\"http://weibo.com/vmdai\" target='_blank'>@VM微美贷</a>",
				placement: "top"
			}
		} else {
			if (a(this).attr("to") == "towin") {
				b = {
					selector: true,
					html: true,
					content: "<div style=\"text-align:center\"><img src=\"./images/main/vm2w.png\" width='126' height='126' /><br/>微信号：vmdaiCN</div>",
					placement: "top"
				}
			} else {
				if (a(this).attr("to") == "toqq") {
					b = {
						selector: true,
						html: true,
						content: "<div class=\"qqkefu\"><p><img src='./images/main/qe.png'/>微美投资1群：367640435</p><p><img src='./images/main/qe.png'/>微美投资2群：290386739</p></div>",
						placement: "top"
					}
				}
			}
		}
		a(this).popover(b).popover("show")
	});
	a(".b-icon-nav").on("mouseleave",
	function() {
		a(this).find("div[class='popover fade top in']").remove()
	})
});
function loading(b) {
	var a = ".";
	if (b.val().length == 7) {
		b.val(b.val().substring(0, 7) + a)
	} else {
		if (b.val().length == 8) {
			b.val(b.val().substring(0, 8) + a)
		} else {
			if (b.val().length == 9) {
				b.val(b.val().substring(0, 9) + a)
			} else {
				if (b.val().length == 10) {
					b.val(b.val().substring(0, 7))
				}
			}
		}
	}
}
var autosize = function() {
	$(function(d) {
		var b = d(window).height();
		var e = d("header").height();
		var c = d("footer").height();
		var a = d(".friend").height();
		if (d(".from_main").length > 0) {
			d(".from_main").css("min-height", b - e - c - a - 106)
		} else {
			if (d(".loan_nav").length > 0) {
				d(".loan_nav").css("min-height", b - e - c - a - 123)
			} else {
				if (d("#help_nav").length > 0) {
					d("#help_nav").css("min-height", b - e - c - a - 105)
				} else {
					if (d(".acc_nav").length > 0) {
						d(".acc_nav").css("min-height", b - e - c - a - 151)
					} else {
						if (d(".content_nav").length > 0) {
							d(".content_nav").css("min-height", b - e - c - a - 102)
						} else {
							if (d(".safe_nav").length > 0) {
								d(".safe_nav").css("min-height", b - e - c - a - 52)
							} else {
								if (d(".aboutus_nav").length > 0) {
									d(".aboutus_nav").css("min-height", b - e - c - a - 52)
								} else {
									if (d(".lend_nav").length > 0) {
										d(".lend_nav").css("min-height", b - e - c - a - 3)
									} else {
										if (d("#industrylist").length > 0) {
											d("#industrylist").css("min-height", b - e - c - a - 52)
										} else {
											if (d("#notice").length > 0) {
												d("#notice").css("min-height", b - e - c - a - 52)
											} else {
												if (d(".waitpage").length > 0) {
													d(".waitpage").css("min-height", b - e - c - a - 82);
													d(".waitpage").css("margin-bottom", "30px")
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}
	})
};
var mainpage = function() {
	$(function(d) {
		if (d(".banner").length > 0) {
			d(".banner").DB_tabMotionBanner({
				key: "b28551",
				autoRollingTime: 5000,
				bgSpeed: 800
			})
		}
		if (d(".media_nav").length > 0) {
			d(".media_nav").DB_tabMotionBanner({
				key: "b28551",
				autoRollingTime: 5000,
				bgSpeed: 800
			})
		}
		d(".main").addClass("projectlist");
		setTimeout("mainpage.setchart()", 1000);
		var b = null,
		c = 200;
		d(".item-img").each(function(e) {
			b = Raphael("itemimg-tag" + e, 122, 120);
			var g = "../images/main/mian-icon" + e + ".png";
			var f = "../images/main/mian-icon" + e + "b.png";
			var j = b.image(g, 0, 0, 122, 122);
			var h = b.image(f, 0, 122, 122, 122);
			d("#itemimg-tag" + e).parent().mouseover(function() {
				j.stop().animate({
					y: -122
				},
				c, "<>");
				h.stop().animate({
					y: 0
				},
				c, "<>")
			});
			d(".item").mouseleave(function() {
				j.stop().attr({
					y: 0
				});
				h.stop().attr({
					y: 122
				})
			});
			
		})
	});
	this.setchart = function() {
		var b;
		var c;
		$("canvas[name='Chart']").each(function() {
			$(this).prev().hide();
			$(this).attr("class", "ft-l");
			b = $(this).get(0).getContext("2d");
			c = [{
				value: Number($(this).attr("progress")),
				color: "#3399ff"
			},
			{
				value: Number(100 - $(this).attr("progress")),
				color: "#f2f2f2"
			}];
			new Chart(b).Doughnut(c, {
				size: 92
			})
		})
	};
	var a = {
		selector: true,
		html: true,
		content: "<span class='ft-l'>投资、借款前，实名认证一下 <a href='http://vmstatic.vmdai.com/user/security?gotobindid'>更安全</a></span><a href='javascript:void(0)' foritem='0' class='close'></a>",
		placement: "bottom"
	};
	$(".userauth").popover(a).popover("show")
};
var feedback = function() {
	$(function($) {
		var feedbackhtml = ' <div class="feedbacknav" >';
		feedbackhtml += '<div class="feedbacktit">';
		feedbackhtml += '<span class="ft-l">问题反馈</span><span class="ft-r feedbackicon">+</span>';
		feedbackhtml += "</div>";
		feedbackhtml += '<div class="feedbacbct">';
		feedbackhtml += ' <form role="form">';
		feedbackhtml += '<div class="form-group">';
		feedbackhtml += '<label for="exampleInputPassword1">描述：</label>';
		feedbackhtml += '<textarea class="form-control" id="feedalt" placeholder="描述"></textarea>';
		feedbackhtml += "</div>";
		feedbackhtml += '<button type="button" class="btn btn-default ft-r" id="upFeedBack">提交</button>';
		feedbackhtml += "</form>";
		feedbackhtml += "</div>";
		feedbackhtml += "</div>";
		$("body").append(feedbackhtml);
		$(".feedbacknav").css("top", $(window).height() - 45);
		$(".feedbacktit").on("click",
		function() {
			if ($(".feedbackicon").text() == "+") {
				$(".feedbacknav").animate({
					height: "270px",
					top: $(window).height() - 270
				},
				"fast");
				$(".feedbackicon").text("-")
			} else {
				if ($(".feedbackicon").text() == "-") {
					$(".feedbacknav").animate({
						height: "45px",
						top: $(window).height() - 45
					},
					"fast");
					$(".feedbackicon").text("+")
				}
			}
		});
		if ($("#upFeedBack").length > 0) {
			$("#upFeedBack").on("click",
			function() {
				$.post("../default/feedback?contents=" + $("#feedalt").val() + "",
				function(data) {
                                   
					var jsondata = eval("(" + data + ")");
                                        
					if (jsondata.message == "success") {
						$.vmalert({
							title: "提示",
							content: "<center>提交成功</center>",
							modelid: "feedbackmodal",
							size_w: "m"
						});
						$(".feedbacknav").animate({
							height: "45px",
							top: $(window).height() - 45
						},
						"fast");
						$(".feedbackicon").text("+");
						$("#feedalt").val("")
					}
				})
			})
		}
	})
};
var countview = function() {
	var a;
	var b;
	var c = $("#thisRole").val();
	$(function() {
		setTimeout("countview.setcharts()", 100)
	});
	this.setcharts = function() {
		$("canvas[name='countCanvas']").each(function(d) {
			if (d == 0) {
				a = $(this).get(0).getContext("2d");
				if (c == "borrow") {
					b = {
						labels: ["借款利息", "逾期费用", "借款服务费"],
						datasets: [{
							fillColor: "rgba(151,187,205,0.5)",
							strokeColor: "rgba(151,187,205,1)",
							data: [Number(($("#br-lx").text().split("¥")[1]).replace(/\,/, "")), Number(($("#br-fy").text().split("¥")[1]).replace(/\,/, "")), Number(($("#br-fw").text().split("¥")[1]).replace(/\,/, ""))]
						}]
					}
				} else {
					if (c == "lend") {
						b = {
							labels: ["已赚利息", "已赚罚息"],
							datasets: [{
								fillColor: "rgba(151,187,205,0.5)",
								strokeColor: "rgba(151,187,205,1)",
								data: [Number(($("#yz-lx").text().split("¥")[1]).replace(/\,/, "")), Number(($("#yz-fy").text().split("¥")[1]).replace(/\,/, ""))]
							}]
						}
					}
				}
			} else {
				if (d == 1) {
					a = $(this).get(0).getContext("2d");
					if (c == "borrow") {
						b = {
							labels: ["待还本金", "待还利息", "待还逾期费用"],
							datasets: [{
								fillColor: "rgba(151,187,205,0.5)",
								strokeColor: "rgba(151,187,205,1)",
								data: [Number(($("#dh-bj").text().split("¥")[1]).replace(/\,/, "")), Number(($("#dh-lx").text().split("¥")[1]).replace(/\,/, "")), Number(($("#dh-yq").text().split("¥")[1]).replace(/\,/, ""))]
							}]
						}
					} else {
						if (c == "lend") {
							b = {
								labels: ["房产抵押贷", "票据贷", "企业经营贷", "消费周转贷", "应收安全贷"],
								datasets: [{
									fillColor: "rgba(151,187,205,0.5)",
									strokeColor: "rgba(151,187,205,1)",
									data: [Number(($("#d-fc").text().split("¥")[1]).replace(/\,/, "")), Number(($("#d-sp").text().split("¥")[1]).replace(/\,/, "")), Number(($("#d-qy").text().split("¥")[1]).replace(/\,/, "")), Number(($("#d-xf").text().split("¥")[1]).replace(/\,/, "")), Number(($("#d-ys").text().split("¥")[1]).replace(/\,/, ""))]
								}]
							}
						}
					}
				} else {
					if (d == 2) {
						a = $(this).get(0).getContext("2d");
						if (c == "borrow") {
							b = {
								labels: ["已还本金", "已还利息", "已还逾期费用"],
								datasets: [{
									fillColor: "rgba(151,187,205,0.5)",
									strokeColor: "rgba(151,187,205,1)",
									data: [Number(($("#yh-bj").text().split("¥")[1]).replace(/\,/, "")), Number(($("#yh-lx").text().split("¥")[1]).replace(/\,/, "")), Number(($("#yh-yq").text().split("¥")[1]).replace(/\,/, ""))]
								}]
							}
						}
					}
				}
			}
			new Chart(a).Bar(b, {
				barValueSpacing: 35
			})
		})
	}
};
var helpview = function() {
	$("#help_item .panel").on("mouseover",
	function() {
		$(this).css("border", "1px solid #428bca")
	}).on("mouseleave",
	function() {
		$(this).css("border", "1px solid #dddddd")
	})
};
var bindview = function() {
	$(function($) {
		var thispageurl = location.href;
		if (thispageurl.split("?")[1] == "gotobindid") {
			$("div[name='gotobindid']").click()
		} else {
			if (thispageurl.split("?")[1] == "gotobindmobile") {
				$("div[name='gotobindmobile']").click()
			} else {
				if (thispageurl.split("?")[1] == "gotobindemail") {
					$("div[name='gotobindemail']").click()
				} else {
					if (thispageurl.split("?")[1] == "editpwdbtn") {
						$("#editpwdbtn").click()
					}
				}
			}
		}
	});
	$(".item").on("click",
	function() {
		var onthis = $(this).find("div[class='gobindnav']").length;
		if ($(this).attr("static") != "on") {
			$(".item").removeAttr("static");
			$(this).attr("static", "on");
			$("#authview").find("div[class='panel panel-primary']").hide();
			if ($(this).attr("name") == "gotobindmobile") {
				$.get("/user/bindmobile",
				function(data) {
					$("#bindmobile").html(data);
					if (onthis > 0) {
						$("#bindmobile").prev().find("h3").text("绑定手机")
					} else {
						$("#bindmobile").prev().find("h3").text("修改绑定手机")
					}
					if ($("#getauthcode").length > 0) {
						$("#getauthcode").on("click",
						function() {
							var mobile = $("#mobile").val();
							$.post("/mobilecode?mobile=" + mobile + "&mobiletype=0",
							function(data) {
								var json = eval("(" + data + ")");
								if (json.StatusId == 0) {
									$.scojs_message(json.ResponseStatus.Message.split(":")[1], $.scojs_message.TYPE_ERROR)
								} else {
									time("getauthcode")
								}
							})
						})
					}
					if ($("#getmobilecode").length > 0) {
						$("#getmobilecode").on("click",
						function() {
							var mobile = $("#mobile").val();
							$.post("/mobilecode?mobile=" + mobile + "&mobiletype=1",
							function(data) {
								var json = eval("(" + data + ")");
								if (json.StatusId == 0) {
									$.scojs_message(json.ResponseStatus.Message.split(":")[1], $.scojs_message.TYPE_ERROR)
								} else {
									time("getmobilecode")
								}
							})
						})
					}
					if ($("#getnewmobilecode").length > 0) {
						$("#getnewmobilecode").on("click",
						function() {
							var mobile = $("#newmobile").val();
							$.post("/mobilecode?mobile=" + mobile + "&mobiletype=3",
							function(data) {
								var json = eval("(" + data + ")");
								if (json.StatusId == 0) {
									$.scojs_message(json.ResponseStatus.Message.split(":")[1], $.scojs_message.TYPE_ERROR)
								} else {
									wait = 60;
									time("getnewmobilecode")
								}
							})
						})
					}
					if ($("#originalmobilebtn").length > 0) {
						$("#originalmobilebtn").on("click",
						function() {
							$.post("/user/originalmobile?originalmobilecode=" + $("#originalmobilecode").val() + "&mobile=" + $("#mobile").val() + "",
							function(data) {
								var json = eval("(" + data + ")");
								if (json.StatusId == 0) {
									$.scojs_message(json.ResponseStatus.Message.split(":")[1], $.scojs_message.TYPE_ERROR)
								} else {
									if (json.StatusId == 1) {
										$.scojs_message("解绑成功", $.scojs_message.TYPE_OK);
										var navhtml = '<div class="gobindnav"><div class="authicon mobile"></div><a href="javascript:void(0)">[去设置]</a></div>';
										$("#bindmobilenav").html(navhtml);
										$("#originalmobilenav").hide();
										$("#newmobilenav").show()
									}
								}
							})
						})
					}
					if ($("#bindmobilebtn").length > 0) {
						$("#bindmobilebtn").on("click",
						function() {
							$.post("/user/bindmobile?mobilecode=" + $("#mobilecode").val() + "&mobile=" + $("#mobile").val() + "",
							function(data) {
								var json = eval("(" + data + ")");
								if (json.StatusId == 0) {
									$.scojs_message(json.ResponseStatus.Message.split(":")[1], $.scojs_message.TYPE_ERROR)
								} else {
									if (json.StatusId == 1) {
										$.scojs_message("绑定成功", $.scojs_message.TYPE_OK);
										var navhtml = '<div class="authicon mobileed"></div><div class="set_t">手机号 ' + $("#mobile").val().substring(0, 3) + "*****" + $("#mobile").val().substring($("#mobile").val().length - 3, $("#mobile").val().length) + '</div><div class="set_l"><a href="javascript:void(0)" id="editmobile">修改</a></div>';
										$("#bindmobilenav").html(navhtml);
										$("#bindmobile").parent().slideUp();
										$("div[name='gotobindmobile']").attr("static", "")
									}
								}
							})
						})
					}
					if ($("#editbindmobile").length > 0) {
						$("#editbindmobile").on("click",
						function() {
							$.post("/user/bindnewmobile?newmobile=" + $("#newmobile").val() + "&newmobilecode=" + $("#newmobilecode").val() + "",
							function(data) {
								var json = eval("(" + data + ")");
								if (json.StatusId == 0) {
									$.scojs_message(json.ResponseStatus.Message.split(":")[1], $.scojs_message.TYPE_ERROR)
								} else {
									if (json.StatusId == 1) {
										$.scojs_message("绑定成功", $.scojs_message.TYPE_OK);
										var navhtml = '<div class="authicon mobileed"></div><div class="set_t">手机号 ' + $("#newmobile").val().substring(0, 3) + "*****" + $("#newmobile").val().substring($("#newmobile").val().length - 3, $("#newmobile").val().length) + '</div><div class="set_l"><a href="javascript:void(0)" id="editmobile">修改</a></div>';
										$("#bindmobilenav").html(navhtml);
										$("#bindmobile").parent().slideUp();
										$("div[name='gotobindmobile']").attr("static", "")
									}
								}
							})
						})
					}
					if ($("#editmobile").length > 0) {
						$("#editmobile").click(function() {
							$("#nav-mobile").show()
						})
					}
				});
				$("#nav-mobile").show()
			} else {
				if ($(this).attr("name") == "gotobindemail") {
					$.get("/user/bindemail",
					function(data) {
						$("#bindemail").html(data);
						if (onthis > 0) {
							$("#bindemail").prev().find("h3").text("绑定邮箱")
						} else {
							$("#bindemail").prev().find("h3").text("修改绑定邮箱")
						}
						if ($("#getemailcode").length > 0) {
							$("#getemailcode").on("click",
							function() {
								var email = $("#email").val();
								$.post("/emailcode?email=" + email + "&emailtype=" + $(this).attr("datatype") + "",
								function(data) {
									var json = eval("(" + data + ")");
									if (json.StatusId == 0) {
										$.scojs_message(json.ResponseStatus.Message.split(":")[1], $.scojs_message.TYPE_ERROR)
									} else {
										time("getemailcode")
									}
								})
							})
						}
						if ($("#bindemailbtn").length > 0) {
							$("#bindemailbtn").on("click",
							function() {
								$.post("/user/bindemail?emailcode=" + $("#emailcode").val() + "&email=" + $("#email").val() + "",
								function(data) {
									var json = eval("(" + data + ")");
									if (json.StatusId == 0) {
										$.scojs_message(json.ResponseStatus.Message.split(":")[1], $.scojs_message.TYPE_ERROR)
									} else {
										if (json.StatusId == 1) {
											$.scojs_message("绑定成功", $.scojs_message.TYPE_OK);
											var navhtml = '<div class="authicon emailed"></div><div class="set_t">邮箱地址 ' + $("#email").val().substring(0, 3) + "*****@" + $("#email").val().split("@")[1] + '</div><div class="set_l"><a href="javascript:void(0)" id="editemail">修改</a></div>';
											$("#bindemailnav").html(navhtml);
											$("#bindemail").parent().slideUp();
											$("div[name='gotobindemail']").attr("static", "")
										}
									}
								})
							})
						}
						if ($("#getnewemailcode").length > 0) {
							$("#getnewemailcode").on("click",
							function() {
								$.post("/emailcode?email=" + $("#newemail").val() + "&emailtype=0",
								function(data) {
									var json = eval("(" + data + ")");
									if (json.StatusId == 0) {
										$.scojs_message(json.ResponseStatus.Message.split(":")[1], $.scojs_message.TYPE_ERROR)
									} else {
										wait = 60;
										time("getnewemailcode")
									}
								})
							})
						}
						if ($("#originalemailbtn").length > 0) {
							$("#originalemailbtn").click(function() {
								$.post("/user/verifyemail?emailcode=" + $("#emailcode").val() + "&email=" + $("#email").val() + "",
								function(data) {
									var json = eval("(" + data + ")");
									if (json.StatusId == 0) {
										$.scojs_message(json.ResponseStatus.Message.split(":")[1], $.scojs_message.TYPE_ERROR)
									} else {
										if (json.StatusId == 1) {
											$.scojs_message("解绑成功", $.scojs_message.TYPE_OK);
											var navhtml = '<div class="gobindnav"><div class="authicon email"></div><a href="javascript:void(0)">[去设置]</a></div>';
											$("#bindemailnav").html(navhtml);
											$("#originalemailnav").hide();
											$("#bindnewemail").slideDown();
											clearTimeout(timevl)
										}
									}
								})
							})
						}
						if ($("#getnewemail").length > 0) {
							$("#getnewemail").click(function() {
								$.post("/user/bindnewemail?newemail=" + $("#newemail").val() + "&newcode=" + $("#newcode").val() + "",
								function(data) {
									var json = eval("(" + data + ")");
									if (json.StatusId == 0) {
										$.scojs_message(json.ResponseStatus.Message.split(":")[1], $.scojs_message.TYPE_ERROR)
									} else {
										if (json.StatusId == 1) {
											$.scojs_message("绑定成功", $.scojs_message.TYPE_OK);
											var navhtml = '<div class="authicon emailed"></div><div class="set_t">邮箱地址 ' + $("#email").val().substring(0, 3) + "*****@" + $("#email").val().split("@")[1] + '</div><div class="set_l"><a href="javascript:void(0)" id="editemail">修改</a></div>';
											$("#bindemailnav").html(navhtml);
											$("#bindemail").parent().slideUp();
											$("div[name='gotobindemail']").attr("static", "")
										}
									}
								})
							})
						}
						if ($("#editemail").length > 0) {
							$("#editemail").click(function() {
								$("#nav-email").show()
							})
						}
					});
					$("#nav-email").show()
				} else {
					if ($(this).attr("name") == "gotobindid") {
						$.get("/user/identity",
						function(data) {
							$("#bindid").html(data);
							$("#identityfrom").validate({
								rules: {
									realname: {
										required: true,
										zh: /[\u4E00-\u9FA5]{2,5}(?:·[\u4E00-\u9FA5]{2,5})*/,
										minlength: 2,
										maxlength: 13
									},
									idnum: {
										required: true,
										iscard: true
									}
								},
								messages: {
									realname: {
										required: "请输入真实姓名",
										zh: "请输入至少2个中文",
										minlength: "真实姓名至少2个汉字",
										maxlength: "真实姓名至多5个汉字"
									},
									idnum: {
										required: "请输入身份证号码",
										iscard: "请输入正确的身份证号码"
									}
								},
								submitHandler: function(form) {
									identity()
								}
							});
							$.validator.addMethod("zh",
							function(value, element, params) {
								var exp = new RegExp(params);
								return exp.test(value)
							});
							$.validator.addMethod("iscard",
							function(value, element, params) {
								if (params) {
									return isIdCardNo(value)
								}
								return true
							})
						});
						$("#nav-id").show()
					}
				}
			}
		}
		$(window).scrollTop($(document).height())
	});
	function identity() {
		var realnames = encodeURI($("#realname").val(), "UTF-8");
		$.post("/user/identity?realname=" + realnames + "&idnum=" + $("#idnum").val() + "",
		function(data) {
			var json = eval("(" + data + ")");
			if (json.StatusId == 0) {
				$.scojs_message(json.ResponseStatus.Message, $.scojs_message.TYPE_ERROR)
			} else {
				if (json.StatusId == 1) {
					$.scojs_message("绑定成功", $.scojs_message.TYPE_OK);
					var navhtml = '<div class="authicon piped"></div><div class="set_t">身份证号 ' + $("#idnum").val().substring(0, 2) + "************** &nbsp;&nbsp;&nbsp;" + $("#realname").val().substring(0, 1) + "**</div>";
					$("#bindidnav").html(navhtml);
					$("#nav-id").slideUp();
					$("div[name='gotobindid']").attr("static", "")
				}
			}
		})
	}
	$("#editpwdbtn").on("click",
	function() {
		$.get("/user/modifypwd",
		function(data) {
			$("#editpwd").html(data);
			$("#pwd-mobile").slideDown();
			if ($("#modifypwd").length > 0) {
				$("#modifypwd").validate({
					rules: {
						pwd: {
							required: true,
							regexpwd: /[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/,
							maxlength: 16,
							minlength: 8
						},
						newpwd: {
							required: true,
							regexpwd: /[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/,
							maxlength: 16,
							minlength: 8
						},
						newpwd2: {
							required: true,
							equalTo: "#newpwd",
							regexpwd: /[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/,
							maxlength: 16,
							minlength: 8
						}
					},
					messages: {
						pwd: {
							required: "请输入原密码",
							regexpwd: "密码由字母，数字和特殊字符组成，且必须包含字母和数字",
							maxlength: "密码长度请保持在8至16位之间",
							minlength: "密码长度请保持在8至16位之间"
						},
						newpwd: {
							required: "请输入新密码",
							regexpwd: "密码由字母，数字和特殊字符组成，且必须包含字母和数字",
							maxlength: "密码长度请保持在8至16位之间",
							minlength: "密码长度请保持在8至16位之间"
						},
						newpwd2: {
							required: "请确认新密码",
							equalTo: "新密码不一致，请确认",
							regexpwd: "密码由字母，数字和特殊字符组成，且必须包含字母和数字",
							maxlength: "密码长度请保持在8至16位之间",
							minlength: "密码长度请保持在8至16位之间"
						}
					},
					submitHandler: function(form) {
						modifypwd()
					}
				});
				$.validator.addMethod("regexpwd",
				function(value, element, params) {
					var exp = new RegExp(params);
					return exp.test(value)
				})
			}
		});
		$(window).scrollTop($(document).height())
	});
	$(".icon_close ").click(function() {
		$(this).parent().parent().slideUp();
		$("div[name=" + $(this).attr("closeto") + "]").removeAttr("static")
	});
	function modifypwd() {
		$.post("/user/modifypwd?pwd=" + $("#pwd").val() + "&newpwd=" + $("#newpwd").val() + "&newpwd2=" + $("#newpwd2").val() + "",
		function(data) {
			var json = eval("(" + data + ")");
			if (json.StatusId == 0) {
				$.scojs_message(json.ResponseStatus.Message, $.scojs_message.TYPE_ERROR)
			} else {
				if (json.StatusId == 1) {
					$.scojs_message("修改成功", $.scojs_message.TYPE_OK);
					$("#pwd-mobile").slideUp()
				}
			}
		})
	}
};
function openfeedback() {
	$(".feedbacknav").animate({
		height: "270px",
		top: $(window).height() - 270
	},
	"fast");
	$(".feedbackicon").text("-")
}
var projectdetailnew = function() {
	setTimeout("projectdetailnew.setchart()", 1000);
	$("#lendtabnav").find("li").each(function() {
		$(this).on("click",
		function() {
			$(".panel-lend").hide();
			$("#" + $(this).attr("to")).show();
			$("#lendtabnav").find("li").removeClass("active");
			$(this).addClass("active")
		})
	});
	if ($(".date").text() != "已经结束") {
		var b = new Date($(".date").text()),
		a = Math.round(b / 1000);
		$(".date").scojs_countdown({
			until: a
		})
	}
	this.setchart = function() {
		var c;
		var d;
		$("canvas[name='Chart']").each(function() {
			$(this).prev().hide();
			$(this).attr("class", "");
			c = $(this).get(0).getContext("2d");
			d = [{
				value: Number($(this).attr("progress")),
				color: "#27b3e9"
			},
			{
				value: Number(100 - $(this).attr("progress")),
				color: "#F2F2F2"
			}];
			new Chart(c).Doughnut(d, {
				size: 105
			})
		})
	}
};
var wait = 60;
var timevl;
function time(b) {
	var a = document.getElementById(b);
	if (wait == 0) {
		a.removeAttribute("disabled");
		a.value = "获取验证码";
		wait = 60
	} else {
		a.setAttribute("disabled", true);
		a.value = "重新发送(" + wait + ")";
		wait--;
		timevl = setTimeout(function() {
			time(b)
		},
		1000)
	}
}
var accountfirst = function(a) {
	$(function(e) {
		if (a == "True") {
			var d = ' <div class="user_guide">';
			d += '<div class="guidenav"><div class="guide_1"><a href="javascript:void(0)" class="guideclose1"></a><div class="guidenext1"></div></div>';
			d += '<div class="guide_2"><a href="javascript:void(0)" class="guideclose2"></a><div class="guidenext2"></div></div>';
			d += '<div class="guide_3"><a href="javascript:void(0)" class="guideclose3"></a><div class="guidenext3"></div></div></div>';
			d += "</div>";
			e("body").append(d);
			e(".user_guide").height(e("body").height());
			e(".user_guide").width(e("body").width())
		}
		e(".guideclose1,.guideclose2,.guideclose3").on("click",
		function() {
			e(".user_guide").remove()
		});
		var b = 0;
		e(".user_guide").on("click",
		function() {
			if (b == 0) {
				e(".guide_1").hide();
				e(".guide_2").show(function() {
					b = 1
				})
			} else {
				if (b == 1) {
					e(".guide_2").hide();
					e(".guide_3").show(function() {
						b = 2
					})
				}
			}
		});
		e(".guidenext3").on("click",
		function() {
			e(".guidenav").fadeOut(function() {
				e(".user_guide").remove()
			})
		});
		if (e.cookie("VMIsIdValidate_") == "0" && e.cookie("VMIsIdValidate_") != null) {
			var c = {
				selector: true,
				html: true,
				content: "<span class='ft-l'>投资、借款前，实名认证一下 <a href='http://vmstatic.vmdai.com/user/security?gotobindid'>更安全</a></span><a href='javascript:void(0)' foritem='0' class='close'></a>",
				placement: "bottom"
			};
			e(".userauth").popover(c).popover("show")
		} else {
			if (e.cookie("VMIsEmailValidate_") == "0" && e.cookie("VMIsEmailValidate_") != null) {
				var c = {
					selector: true,
					html: true,
					content: "<span class='ft-l'>绑定您的邮箱 <a href='http://vmstatic.vmdai.com/user/security?gotobindemail'>更完美</a></span><a href='javascript:void(0)' foritem='2' class='close'></a>",
					placement: "bottom"
				};
				e(".msgauth").popover(c).popover("show")
			} else {
				if (e.cookie("VMIsMobileValidate_") == "0" && e.cookie("VMIsMobileValidate_") != null) {
					var c = {
						selector: true,
						html: true,
						content: "<span class='ft-l'>投资、借款前，绑定您的手机 <a href='http://vmstatic.vmdai.com/user/security?gotobindmobile'>更方便</a></span><a href='javascript:void(0)' foritem='1' class='close'></a>",
						placement: "bottom"
					};
					e(".phoneauth").popover(c).popover("show")
				}
			}
		}
		e(".popover-content").find('a[class="close"]').on("click",
		function() {
			if (e(this).attr("foritem") == "0") {
				e(".userauth").popover("destroy");
				e.cookie("VMIsIdValidate_", 1, {
					domain: "http://vmstatic.vmdai.com/js/vmdai.com"
				})
			} else {
				if (e(this).attr("foritem") == "2") {
					e(".msgauth").popover("destroy");
					e.cookie("VMIsEmailValidate_", 1, {
						domain: "http://vmstatic.vmdai.com/js/vmdai.com"
					})
				} else {
					if (e(this).attr("foritem") == "1") {
						e(".phoneauth").popover("destroy");
						e.cookie("VMIsMobileValidate_", 1, {
							domain: "http://vmstatic.vmdai.com/js/vmdai.com"
						})
					}
				}
			}
		})
	})
};
$.vmalert = function(i) {
	var a = $.extend({},
	$.vmalert.defaults, i);
	var d = $.meta ? $.extend({},
	a, $this.data()) : a;
	$("#" + d.modelid).remove();
	if (d.isLC == true) {
		var f = '<div class="modal vmalert fade" id="' + d.modelid + '" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false">';
		f += '<div class="act1alert">';
		f += '<div class="tit">' + d.title + "</div>";
		f += '<a href="javascript:void(0)" class="btn btn-primary actalertbtn1">这就来</a><div class="alt">活动详情请见新手活动<div>';
		f += "</div>";
		f += "</div>";
		$("body").append(f);
		$("#" + d.modelid).modal("show");
		$(".actalertbtn1").on("click",
		function() {
			$("#" + d.modelid).modal("hide")
		});
		$("#" + d.modelid).on("hidden.bs.modal",
		function(j) {
			new accountfirst(iffirst)
		})
	} else {
		var g;
		if (d.size_w == "sm") {
			g = 'style="width:500px;margin-top:200px"'
		} else {
			if (d.size_w == "m") {
				g = 'style="width:200px;margin-top:200px"'
			} else {
				g = ""
			}
		}
		var h,
		e,
		b,
		c;
		if (d.tBtn.length == 0 || d.fBtn.length == 0) {
			b = "alertCenter"
		} else {
			b = ""
		}
		if (d.href != false) {
			c = "onclick=\"window.location.href='" + d.href + "'\""
		}
		if (d.tBtn.length > 0) {
			h = '<button type="button" class="btn btn-primary ' + b + '" ' + c + ">" + d.tBtn + "</button>"
		} else {
			h = ""
		}
		if (d.fBtn.length > 0) {
			e = '<button type="button" class="btn btn-default ' + b + '" data-dismiss="modal">o.btn_g</button>'
		} else {
			e = ""
		}
		var f = '<div class="modal vmalert fade" id="' + d.modelid + '" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="false">';
		f += '<div class="modal-dialog" ' + g + " >";
		f += ' <div class="modal-content">';
		f += '<div class="modal-header">';
		f += '<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>';
		f += '<h4 class="modal-title" id="myModalLabel">' + d.title + "</h4>";
		f += "</div>";
		f += '<div class="modal-body">';
		f += d.content;
		f += "</div>";
		f += '<div class="modal-footer">' + h + e + "</div>";
		f += "</div></div></div>";
		$("body").append(f);
		$("#" + d.modelid).modal("show")
	}
};
$.vmalert.defaults = {
	title: "提示",
	content: "",
	modelid: "alertmod",
	size_w: "sm",
	tBtn: "",
	fBtn: "",
	href: false,
	isLC: false
};
var bindcard = function() {
	$(document).ready(function() {
		$("#Province").change(function() {
			var c = $("#Province").find("option:selected").val();
			var b = "http://" + window.location.host + "/fund/initcity?";
			$.ajax({
				type: "POST",
				url: b,
				dataType: "json",
				data: "ProvinceID=" + c,
				success: function(d) {
					$("#BankCityId").empty();
					$("#BankCityId").append("<option value=''>请选择</option>");
					$.each(d.CityList,
					function(e, f) {
						$("#BankCityId").append("<option value=" + f.Id + ">" + f.CityName + "</option>")
					})
				}
			})
		});
		$("#BranchName").on("input propertychange dblclick focusin",
		function(b) {
			$.ajax({
				type: "POST",
				url: "http://" + window.location.host + "/fund/initbranch?",
				dataType: "json",
				data: "BankTypeId=" + $("#BankTypeId").find("option:selected").val() + "&KeyWord=" + $("#BranchName").val(),
				success: function(e) {
					if (e.BranchList == undefined) {
						return
					}
					if ($(".bankmodel").length > 0) {
						$(".bankmodel").find("ul").html("")
					} else {
						var d = "<div class='bankmodel'><ul></ul></div>"
					}
					$("body").append(d);
					for (var c = 0; c < e.BranchList.length; c++) {
						$(".bankmodel").find("ul").append("<li title=" + e.BranchList[c].BranchName + " id=" + e.BranchList[c].Id + ">" + e.BranchList[c].BranchName + "</li>")
					}
					if (e.BranchList.length > 10) {
						$(".bankmodel").css("height", "250px")
					}
					var f = 15;
					if (getBowsie()) {
						f = 2
					}
					$(".bankmodel").css("top", $("#BranchName").offset().top + $("#BranchName").height() + f).css("left", $("#BranchName").offset().left).show();
					$(".bankmodel").find("li").each(function() {
						$(this).on("click",
						function() {
							$("#BranchName").val($(this).text());
							$("#BankBranchId").val($(this).attr("id"));
							$(".bankmodel").remove()
						})
					});
					$(".bankmodel").on("mouseleave",
					function() {
						$(this).remove();
						a = 0
					})
				}
			})
		});
		var a = 0;
		$("#BranchName").on("keyup",
		function(d) {
			var b = d.which;
			if (b == 40 && $(".bankmodel").length > 0 && $(".bankmodel").css("display") == "block" && $(".bankmodel").find("li").length > 0) {
				$(".bankmodel").find("li").removeClass("on");
				var c = $(".bankmodel").find("li").eq(a);
				c.addClass("on");
				a++;
				if (a > 10) {
					$(".bankmodel").scrollTop(25 * (a - 10))
				}
			}
			if ($(".bankmodel").css("display") == "none" && b == 40 && $(".bankmodel").find("li").length > 0) {
				$(".bankmodel").show()
			}
			if (b == 38 && $(".bankmodel").length > 0 && $(".bankmodel").css("display") == "block" && $(".bankmodel").find("li").length > 0 && a > 0) {
				if (a < $(".bankmodel").find("li").length) {
					if (a > 1) {
						a--
					}
					var c;
					$(".bankmodel").find("li").removeClass("on");
					if (a == 0) {
						c = $(".bankmodel").find("li").eq(a)
					} else {
						c = $(".bankmodel").find("li").eq(a - 1)
					}
					c.addClass("on");
					$(".bankmodel").scrollTop(25 * (a - 10))
				}
			}
			if (b == 13 && $(".bankmodel").length > 0 && $(".bankmodel").css("display") == "block" && $(".bankmodel").find("li").length > 0) {
				$("#BranchName").val($(".bankmodel").find("li[class='on']").text());
				$("#BankBranchId").val($(".bankmodel").find("li[class='on']").attr("id"));
				$(".bankmodel").hide()
			}
		});
		$("#cashbanksave").on("click",
		function() {
			var c = 0;
			if ($("#BankCardId").val().length > 0) {
				c = $("#BankCardId").val()
			}
			var b = "BankCardId=" + c + "&RealName=" + $("#RealName").val() + "&BankNumber=" + $("#BankNumber").val() + "&NewBankNumber=" + $("#NewBankNumber").val() + "&BankTypeId=" + $("#BankTypeId").find("option:selected").val() + "&BranchName=" + $("#BranchName").val() + "&BankCityId=" + $("#BankCityId").find("option:selected").val() + "&BankBranchId=" + $("#BankBranchId").val() + "&ReNewBankNumber=" + $("#ReNewBankNumber").val() + "&ReBankNumber=" + $("#ReBankNumber").val() + "&ReBankName=" + $("#ReBankName").val();
			$.ajax({
				type: "POST",
				url: "/fund/bindcard?",
				dataType: "json",
				data: b,
				success: function(d) {
					if (d.ResponseStatus.ErrorCode == "1") {
						$.scojs_message("添加成功", $.scojs_message.TYPE_OK);
						setTimeout("parent.location.reload()", 2000)
					} else {
						$.scojs_message(d.ResponseStatus.Message, $.scojs_message.TYPE_ERROR)
					}
				}
			})
		})
	})
};
$.fn.bankInput = function(a) {
	var d = {
		min: 10,
		max: 23,
		deimiter: "-",
		onlyNumber: true,
		copy: true
	};
	var b = $.extend({},
	d, a);
	var c = $(this);
	c.css({
		imeMode: "Disabled",
		borderWidth: "1px",
		color: "#000",
		fontFamly: "Times New Roman"
	}).attr("maxlength", b.max);
	if (c.val() != "") {
		c.val(c.val().replace(/\s/g, "").replace(/(\d{4})(?=\d)/g, "$1" + b.deimiter))
	}
	c.bind("keyup",
	function(e) {
		if (b.onlyNumber) {
			if (! (e.keyCode >= 48 && e.keyCode <= 57)) {
				this.value = this.value.replace(/\D/g, "")
			}
		}
		this.value = this.value.replace(/\s/g, "").replace(/(\d{4})(?=\d)/g, "$1" + b.deimiter)
	}).bind("dragenter",
	function() {
		return false
	}).bind("onpaste",
	function() {
		return ! clipboardData.getData("text").match(/\D/)
	}).bind("blur",
	function() {
		this.value = this.value.replace(/\s/g, "").replace(/(\d{4})(?=\d)/g, "$1" + b.deimiter)
	})
};
$.fn.bankList = function(a) {
	var c = {
		deimiter: " "
	};
	var b = $.extend({},
	c, a);
	return this.each(function() {
		$(this).text($(this).text().replace(/\s/g, "").replace(/(\d{4})(?=\d)/g, "$1" + b.deimiter))
	})
};
function getBowsie() {
	if (navigator.userAgent.indexOf("MSIE") > 0) {
		if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
			return true
		}
		if (navigator.userAgent.indexOf("MSIE 7.0") > 0) {
			return true
		}
		if (navigator.userAgent.indexOf("MSIE 8.0") > 0) {
			return true
		}
		return false
	}
	return false
};